/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author bluepc
 */
@Entity
@Table(name = "Restaurant")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Restaurant.findAll", query = "SELECT r FROM Restaurant r"),
    @NamedQuery(name = "Restaurant.findByIdRes", query = "SELECT r FROM Restaurant r WHERE r.idRes = :idRes"),
    @NamedQuery(name = "Restaurant.findByResName", query = "SELECT r FROM Restaurant r WHERE r.resName = :resName"),
    @NamedQuery(name = "Restaurant.findByResAdd", query = "SELECT r FROM Restaurant r WHERE r.resAdd = :resAdd"),
    @NamedQuery(name = "Restaurant.findByResStatus", query = "SELECT r FROM Restaurant r WHERE r.resStatus = :resStatus")})
public class Restaurant implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer idRes;
    @Size(max = 250)
    @Column(name = "res_name")
    private String resName;
    @Size(max = 250)
    @Column(name = "res_add")
    private String resAdd;
    @Basic(optional = false)
    @NotNull
    @Column(name = "res_status")
    private boolean resStatus;
    @JoinColumn(name = "id_area", referencedColumnName = "id_area")
    @ManyToOne
    private Area idArea;
    @OneToMany(mappedBy = "idRes")
    private List<Tables> tablesList;

    public Restaurant() {
    }

    public Restaurant(Integer idRes) {
        this.idRes = idRes;
    }

    public Restaurant(Integer idRes, boolean resStatus) {
        this.idRes = idRes;
        this.resStatus = resStatus;
    }

    public Integer getIdRes() {
        return idRes;
    }

    public void setIdRes(Integer idRes) {
        this.idRes = idRes;
    }

    public String getResName() {
        return resName;
    }

    public void setResName(String resName) {
        this.resName = resName;
    }

    public String getResAdd() {
        return resAdd;
    }

    public void setResAdd(String resAdd) {
        this.resAdd = resAdd;
    }

    public boolean getResStatus() {
        return resStatus;
    }

    public void setResStatus(boolean resStatus) {
        this.resStatus = resStatus;
    }

    public Area getIdArea() {
        return idArea;
    }

    public void setIdArea(Area idArea) {
        this.idArea = idArea;
    }

    @XmlTransient
    public List<Tables> getTablesList() {
        return tablesList;
    }

    public void setTablesList(List<Tables> tablesList) {
        this.tablesList = tablesList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRes != null ? idRes.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Restaurant)) {
            return false;
        }
        Restaurant other = (Restaurant) object;
        if ((this.idRes == null && other.idRes != null) || (this.idRes != null && !this.idRes.equals(other.idRes))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Restaurant[ idRes=" + idRes + " ]";
    }
    
}
